<form name="form1" method="get" action="%%[base_url]%%/intake2.php">

<h2>Prospective Client</h2>

<div id="intake-search-filters">

    <table cellspacing="0" summary="Prospective Client Filters">
    
        <tr>
        
            <td><label>First Name</label><input class="input160" type="text" name=first_name value="%%[first_name]%%" tabindex="1" /></td>
            <td><label>Last | Org. Name</label><input class="input160" type="text" name=last_name value="%%[last_name]%%" tabindex="1" /></td>
        	<td><label>SSN</label><input class="input100" type="text" name="ssn" onkeyup="pika_ssn(this);" value="%%[ssn]%%" maxlength="11" tabindex="1" /></td>
        	<td><label>Phone</label><input class="input30" type="text" name="area_code" value="%%[area_code]%%" onkeyup="pika_area_code(this, 3, 'phone');" maxlength="3" tabindex="1" /> <input class="input80" type="text" name="phone" value="%%[phone]%%" onkeyup="pika_phone(this);" maxlength="8" tabindex="1" /></td>
        
        </tr>

    </table>

</div> <!-- /#search-filters -->    

<input type="hidden" name="case_id" value="%%[case_id]%%" />
<input type="hidden" name="number" value="%%[number]%%" />
<input type="hidden" name="relation_code" value="%%[relation_code]%%" />
<input type="hidden" name="order_field" value="%%[order_field]%%" />
<input type="hidden" name="order" value="%%[order]%%" />
<input type="hidden" name="offset" value="%%[offset]%%" />

<ul id="prospective-submit">
<li><input type="submit" name="dmodes" value="Search Records" tabindex="1" /></li>
<li><input type="submit" name="dmodeb" value="Browse Contacts" tabindex="1" /></li>
</ul>

</form>

%%[begin:intake_text]%%

<p id="following">The following is a list of existing names in the Pika CMS. Check this list to determine whether the prospective client already exists in the Pika database. (Click on the person's name to see more detailed information and to update their contact information.) If not, click "Continue" below to begin an intake for the new contact.
</p>

%%[end:intake_text]%%

%%[search_list]%%

%%[ab_list]%%

%%[begin:flex_header]%%

<table id="search-list" cellspacing="0" summary="">

	<tbody>

	<tr>
		<th class="first">&nbsp;</th>
		<th>Name</th>
		<th>Phone</th>
		<th>Alt&nbsp;#</th>
		<th>Address</th>
		<th>City</th>
		<th>DOB</th>
		<th class="last">SSN</th>
	</tr>

%%[end:flex_header]%%

%%[begin:flex_row]%%

    <tr class="row%%[row_class]%%">
    
        <td>
			<form action="%%[base_url]%%/ops/new_case.php" method="get">
                <input type="hidden" name="thiscon" value="%%[contact_id]%%" />
				<input type="hidden" name="screen" value="elig" />
				<!-- <input type="submit" value="Use" tabindex="1"/> -->
				<img src="%%[base_url]%%/images/check.gif" width="%%[arrow_img]%%" height="%%[arrow_img]%%" alt="" />
			</form>
        </td>
       	
        <td>
		<a href="%%[base_url]%%/contact.php?contact_id=%%[contact_id]%%">%%[client_name]%%</a>
        </td>
        
        <td>
        %%[client_phone]%% %%[phone_notes]%%
        </td>
        
        <td>
        %%[client_phone_alt]%% %%[phone_notes_alt]%%
        </td>
        
        <td>
        %%[address]%%
        </td>
        
        <td>
        %%[city]%%
        </td>
        
        <td>
        %%[birth_date]%%
        </td>
        
        <td>
        %%[ssn]%%
        </td>

    </tr>

%%[end:flex_row]%%

%%[begin:flex_footer]%%

    </tbody>

</table>

%%[end:flex_footer]%%

%%[begin:new_contact_link]%%

<h3>Begin Intake for a New Contact</h3>

<p>
If there is no record of the prospective client in the Pika database, click "Continue" to begin the intake process and create a new contact record.
</p>

<form action="%%[base_url]%%/ops/new_intake.php" method="get" autocomplete="off">

    <input type="hidden" name="newcon" value="1" />
	<input type="hidden" name="first_name" value="%%[first_name]%%" />
	<input type="hidden" name="middle_name" value="%%[middle_name]%%" />
	<input type="hidden" name="last_name" value="%%[last_name]%%" />
	<input type="hidden" name="extra_name" value="%%[extra_name]%%" />
	<input type="hidden" name="birth_date" value="%%[birth_date]%%" />
	<input type="hidden" name="ssn" value="%%[ssn]%%" />
	<input type="hidden" name="area_code" value="%%[area_code]%%" />
	<input type="hidden" name="phone" value="%%[phone]%%" />
	<input type="hidden" name="screen" value="elig" />
	
    <ul>
    <li><input type="submit" value="Continue" tabindex="1" /></li>
    </ul>
    
</form>

%%[end:new_contact_link]%%

<script language="JavaScript" type="text/javascript"><!--
var old_ssn_length = 0;

function pika_ssn(what)
{
	if (what.value.length == 3 && old_ssn_length == 2)
	{
		what.value += '-';
	}

	if (what.value.length == 6 && old_ssn_length == 5)
	{
		what.value += '-';
	}

	old_ssn_length = what.value.length;
}

var ac_autotab_on = 1;

function pika_area_code(what, max, field_name)
{	
	if (max > 0 && what.value.length >= max && ac_autotab_on == 1)
	{
		eval('document.form1.' + field_name + '.focus()');
	}

	if (what.value.length >= 3)
	{
		ac_autotab_on = 0;
	}

	else if (what.value.length == 0)
	{
		ac_autotab_on = 1;
	}

	return;
}

var old_phone_length = 0;

function pika_phone_orig(what)
{
	if (what.value.length == 3 && old_phone_length == 2)
	{
		what.value += '-';
	}

	old_phone_length = what.value.length;
}

function pika_phone(what)
{
	var valid_chars = "1234567890";
	var x;
	var i;
	
	for (i = 0; i < what.value.length; i++)
	{		
      if (valid_chars.indexOf(what.value.charAt(i)) < 0) 
      {
         what.value = what.value.substring(0, i) + what.value.substring(i+1);
      }
    }
    
    if (what.value.length > 3)
    {
    	what.value = what.value.substring(0, 3) + '-' + what.value.substring(3);
    }
}

document.form1.first_name.focus();

//--></script>
